home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Visual Basic new SourceCode and Projects / Vb E-mail Applictation / MAILLST.FRM (.txt) next >
Encoding:
Visual Basic Form  |  2000-04-15  |  7.2 KB  |  223 lines

  1. VERSION 5.00
  2. Begin VB.Form MailLst 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Mail List"
  5.    ClientHeight    =   3555
  6.    ClientLeft      =   2070
  7.    ClientTop       =   3270
  8.    ClientWidth     =   6630
  9.    Icon            =   "MAILLST.frx":0000
  10.    MDIChild        =   -1  'True
  11.    PaletteMode     =   1  'UseZOrder
  12.    ScaleHeight     =   3555
  13.    ScaleWidth      =   6630
  14.    Begin VB.PictureBox Tools 
  15.       Align           =   2  'Align Bottom
  16.       BackColor       =   &H00C0C0C0&
  17.       BorderStyle     =   0  'None
  18.       Height          =   615
  19.       Left            =   0
  20.       ScaleHeight     =   615
  21.       ScaleWidth      =   6630
  22.       TabIndex        =   2
  23.       Top             =   2940
  24.       Width           =   6630
  25.       Begin VB.Line Line1 
  26.          BorderColor     =   &H00FFFFFF&
  27.          Index           =   1
  28.          X1              =   0
  29.          X2              =   6660
  30.          Y1              =   15
  31.          Y2              =   15
  32.       End
  33.       Begin VB.Line Line1 
  34.          BorderColor     =   &H00000000&
  35.          Index           =   0
  36.          X1              =   0
  37.          X2              =   6660
  38.          Y1              =   0
  39.          Y2              =   0
  40.       End
  41.       Begin VB.Image PrtImage 
  42.          Height          =   480
  43.          Left            =   1200
  44.          Picture         =   "MAILLST.frx":030A
  45.          ToolTipText     =   "Print Message"
  46.          Top             =   60
  47.          Width           =   480
  48.       End
  49.       Begin VB.Image Trash 
  50.          Height          =   480
  51.          Left            =   300
  52.          Picture         =   "MAILLST.frx":0614
  53.          ToolTipText     =   "Delete Message"
  54.          Top             =   60
  55.          Width           =   480
  56.       End
  57.    End
  58.    Begin VB.ListBox MList 
  59.       Height          =   2205
  60.       Left            =   90
  61.       MultiSelect     =   2  'Extended
  62.       TabIndex        =   0
  63.       Top             =   360
  64.       Width           =   6495
  65.    End
  66.    Begin VB.Label Headings 
  67.       AutoSize        =   -1  'True
  68.       BackStyle       =   0  'Transparent
  69.       Caption         =   "Listbox Headings"
  70.       BeginProperty Font 
  71.          Name            =   "Courier New"
  72.          Size            =   9
  73.          Charset         =   0
  74.          Weight          =   400
  75.          Underline       =   0   'False
  76.          Italic          =   0   'False
  77.          Strikethrough   =   0   'False
  78.       EndProperty
  79.       Height          =   225
  80.       Left            =   180
  81.       TabIndex        =   1
  82.       Top             =   60
  83.       Width           =   1680
  84.    End
  85.    Begin VB.Image NewMail 
  86.       Height          =   480
  87.       Left            =   5880
  88.       Picture         =   "MAILLST.frx":091E
  89.       Top             =   2820
  90.       Visible         =   0   'False
  91.       Width           =   480
  92.    End
  93.    Begin VB.Image nonew 
  94.       Height          =   480
  95.       Left            =   5280
  96.       Picture         =   "MAILLST.frx":0C28
  97.       Top             =   2880
  98.       Visible         =   0   'False
  99.       Width           =   480
  100.    End
  101. Attribute VB_Name = "MailLst"
  102. Attribute VB_GlobalNameSpace = False
  103. Attribute VB_Creatable = False
  104. Attribute VB_PredeclaredId = True
  105. Attribute VB_Exposed = False
  106. ' Module variable to hold MouseDown position information.
  107. Dim ListX, ListY
  108. Private Sub Command1_Click()
  109. NewMsg.Show
  110. End Sub
  111. Private Sub Form_Load()
  112.     ' Resize the form.
  113.     Height = 3945
  114.     Call Tools_Resize
  115.      ' Set list box headings.
  116.      a$ = Mid$(Format$("From", "!" + String$(25, "@")), 1, 25)
  117.      b$ = Mid$(Format$("Subject", "!" + String$(35, "@")), 1, 35)
  118.      c$ = "Date"
  119.      Headings = a$ + b$ + c$
  120. End Sub
  121. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  122.     ' If the user is closing the application, let this form unload.
  123.     If UnloadMode = 4 Then
  124.         ' Unloading is permitted.
  125.     Else
  126.         ' If the user is still logged on, minimize the form rather than closing it.
  127.         If VBMail.MapiMess.SessionID <> 0 Then
  128.             Me.WindowState = 1
  129.             Cancel = True
  130.         End If
  131.     End If
  132. End Sub
  133. Private Sub Form_Resize()
  134.     ' If the form isn't minimized, resize the list box to fit the form.
  135.     If WindowState <> 1 Then
  136.         If VBMail.DispTools.Checked Then
  137.             xHeight% = Tools.Height
  138.         Else
  139.             xHeight% = 0
  140.         End If
  141.         ' Check for the minimum form height.
  142.         If Height < 2500 - xHeight% Then
  143.             Height = 2500
  144.             Exit Sub
  145.         End If
  146.         MList.Width = ScaleWidth - MList.Left - 90
  147.         MList.Height = ScaleHeight - 90 - MList.Top - xHeight%
  148.     End If
  149. End Sub
  150. Private Sub MList_Click()
  151. ' Set the message index and enable the
  152. ' Previous and Next buttons as needed.
  153.     Select Case MList.ListIndex
  154.         Case 0
  155.             VBMail.Previous.Enabled = False
  156.         Case MList.ListCount - 1
  157.             VBMail.Next.Enabled = False
  158.         Case Else
  159.             VBMail.Previous.Enabled = True
  160.             VBMail.Next.Enabled = True
  161.     End Select
  162.     VBMail.MapiMess.MsgIndex = MList.ListIndex
  163. End Sub
  164. Private Sub MList_DBLClick()
  165. ' Check to see if the message is currently viewed,
  166. ' and if it isn't, load it into a new form.
  167.     If Not MailLst.MList.ItemData(MailLst.MList.ListIndex) Then
  168.        Dim Msg As New MsgView
  169.        Call LoadMessage(MailLst.MList.ListIndex, Msg)
  170.        MailLst.MList.ItemData(MailLst.MList.ListIndex) = True
  171.     Else
  172.         ' Search through the active windows to
  173.         ' find the window with the correct message to view.
  174.         For i = 0 To Forms.Count - 1
  175.             If TypeOf Forms(i) Is MsgView Then
  176.                 If Val(Forms(i).Tag) = MailLst.MList.ListIndex Then
  177.                     Forms(i).Show
  178.                     Exit Sub
  179.                 End If
  180.             End If
  181.         Next i
  182.      End If
  183. End Sub
  184. Private Sub MList_KeyPress(KeyAscii As Integer)
  185.     ' If the user presses ENTER, process the action as a DblClick event.
  186.     If KeyAscii = 13 Then
  187.         Call MList_DBLClick
  188.     End If
  189. End Sub
  190. Private Sub MList_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  191.     ' Save the X and Y positions to determine the start of the drag-and-drop action.
  192.     ListX = X
  193.     ListY = Y
  194. End Sub
  195. Private Sub MList_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  196.     ' If the mouse button is down and the X,Y position has changed, start dragging.
  197.     If Button = 1 And ((X <> ListX) Or (Y <> ListY)) Then
  198.         MList.Drag 1
  199.     End If
  200. End Sub
  201. Private Sub PrtImage_Click()
  202. ' Print mail.
  203.     Call PrintMail
  204. End Sub
  205. Private Sub PrtImage_DragDrop(Source As Control, X As Single, Y As Single)
  206.     ' Same as File.PrintMessage on the VBMAIL File menu.
  207.     Call PrintMail
  208. End Sub
  209. Private Sub Tools_Resize()
  210.     ' Adjust the width of the lines on the top of the toolbar.
  211.     Line1(0).X2 = Tools.Width
  212.     Line1(1).X2 = Tools.Width
  213.     Tools.Refresh
  214. End Sub
  215. Private Sub Trash_Click()
  216. ' Delete a message (Delete Button or Edit.Delete).
  217.    Call DeleteMessage
  218. End Sub
  219. Private Sub Trash_DragDrop(Source As Control, X As Single, Y As Single)
  220.     ' Delete a message (Delete Button or Edit.Delete).
  221.    Call DeleteMessage
  222. End Sub
  223.